﻿//_______________________________________________________________________________________________________________________
// Copy Right (c) 2010, 2011 SapiensIT Consulting GmbH, all rights reserved
//_______________________________________________________________________________________________________________________
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//_______________________________________________________________________________________________________________________
// PROJECT:     sapiens.at.SharePoint (SharePoint 2010/V4)
//_______________________________________________________________________________________________________________________
// VERSION:     2.0
//_______________________________________________________________________________________________________________________
// DESCRIPTION: 
//_______________________________________________________________________________________________________________________
// LICENSE:     Different licens Types apply to different file types:
//               - Source code files are governed by the MICROSOFT PUBLIC LICENSE (Ms-PL)
//               - Binary files are governed by MSDN CODE GALLERY BINARY LICENSE
//               - Documentation files are governed by CREATIVE COMMONS ATTRIBUTION 3.0 LICENSE
//
//               The licenses can be found at the projects source location.
//               If you do not agree, don't use it!
// 
//_______________________________________________________________________________________________________________________
// Start SharePoint Branding, visit http://www.cliggin.com! Visit us on http://www.sapiens.at! Tell your friends! 
//_______________________________________________________________________________________________________________________
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace Sapiens.at.SharePoint.Entities
{
    /// <summary>
    /// Entity that represents the basic event listitem of SharePoint.
    /// </summary>
    [ContentType(CTYPE_ID)]
    public class Event : Item
    {
        public new const string CTYPE_ID = "0x0102";
        public new static readonly SPContentTypeId CTypeId = new SPContentTypeId(CTYPE_ID);

        public const string LOCATION = "Location";
        public const string EVENT_DATE = "EventDate";
        public const string END_DATE = "EndDate";
        public const string DESCRIPTION = "Description";
        public const string ALL_DAY_EVENT = "fAllDayEvent";
        public const string RECURRENCE = "fRecurrence";
        public const string WORKSPACE = "Workspace";
        public const string WORKSPACE_LINK = "WorkspaceLink";

        #region Properties

        public SPFieldUrlValue Workspace
        {
            get { return new SPFieldUrlValue(Get<string>(WORKSPACE)); }
            set { Set(WORKSPACE, value); }
        }

        public bool WorkspaceLink
        {
            get { return Get<bool>(WORKSPACE_LINK); }
            set { Set(WORKSPACE_LINK, value); }
        }

        public string Location
        {
            get { return Get<string>(LOCATION); }
            set { Set(LOCATION, value); }
        }

        public DateTime EventDate
        {
            get { return Get<DateTime>(EVENT_DATE); }
            set { Set(EVENT_DATE, value); }
        }

        public DateTime EndDate
        {
            get { return Get<DateTime>(END_DATE); }
            set { Set(END_DATE, value); }
        }

        public string Description
        {
            get { return Get<string>(DESCRIPTION); }
            set { Set(DESCRIPTION, value); }
        }

        public bool AllDayEvent
        {
            get { return Get<bool>(ALL_DAY_EVENT); }
            set { Set(ALL_DAY_EVENT, value); }
        }

        public string Recurrence
        {
            get { return Get<string>(RECURRENCE); }
            set { Set(RECURRENCE, value); }
        }

        #endregion

        #region Constructors
        public Event(int id, string title) : base(id, title) { }
        public Event(int id, string title, SPList list) : base(id, title, list) { }
        public Event(SPItemEventProperties eventProperties, SPWeb web) : base(eventProperties, web) { }
        public Event(SPListItem listItem) : base(listItem) { }
        public Event(SPItemEventProperties eventProperties, SPListItem listItem, SPWeb web) : base(eventProperties, listItem, web) { }
        #endregion
    }
}
